package com.lh.eemsserver.Controller;


import com.lh.eemsserver.Service.AdminService;
import com.lh.eemsserver.po.Admin;
import com.lh.eemsserver.po.User;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/Admin")
public class AdminController {
    @Autowired
    private AdminService adminService;

    @RequestMapping("/renewUserInfo")
    public int renewUserInfo(@RequestBody User user) {
        return adminService.renewUserInfo(user);
    }

    @RequestMapping("/newUserInfo")
    public int newUserInfo(@RequestBody User user) {
        return adminService.newUserInfo(user);
    }

    @RequestMapping("/listAllUser")
    public List<User> listAllUser() {
        return adminService.listAllUser();
    }



    @RequestMapping("/getAdminName")
    public Admin getAdminName(@RequestBody Admin admin) {
        return adminService.getAdminName(admin);
    }
//    @RequestMapping("/getAdminName")
//    public Admin getAdminName(@RequestParam("adminID") int adminID,@RequestParam("password") String password) {
//        return adminService.getAdminName(adminID,password);
//    }
    @RequestMapping("/delUserInfo")
    public int delUserInfo(@RequestBody User user) {
        return adminService.delUserInfo(user);
    }
    @RequestMapping("/renewAdminInfo")
    public int renewAdminInfo(@RequestBody Admin admin){
        return adminService.renewAdminInfo(admin);
    }
    @RequestMapping("/getAdminInfo")
    public Admin getAdminInfo(@RequestBody Admin admin){
        return adminService.getAdminInfo(admin);
    }
}
